package com.lvy.hczn.front;

import com.corundumstudio.socketio.SocketIOServer;
import com.lvy.hczn.front.business.service.AccessManagerService;
import com.lvy.hczn.front.system.service.WarehouseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.log.ClientLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@ComponentScans({@ComponentScan("com.lvy.hczn.mq.rocket")})
@Slf4j
public class BusinessApplication implements CommandLineRunner {

    @Autowired
    private SocketIOServer socketIOServer;

    @Autowired
    private WarehouseService warehouseService;

    @Autowired
    private AccessManagerService accessManagerService;

    public static void main(String[] args) {
//        System.setProperty("rocketmq.client.logUseSlf4j", "true");
        System.setProperty(ClientLogger.CLIENT_LOG_USESLF4J, "true");
//        System.setProperty("rocketmq.client.logRoot","/home/wms/logs/business");
        SpringApplication.run(BusinessApplication.class, args);
        log.info("(♥◠‿◠)ﾉﾞ  项目启动成功   ლ(´ڡ`ლ)ﾞ");
    }

    @Override
    public void run(String... args) throws Exception {
        socketIOServer.start();
//        accessManagerService.scan();
//        warehouseService.initBaseData(null);
    }
}
